#include <stdint.h>
#include "memory.h"

#define MEMORY_POOL_SIZE 1024 * 1024  // 1 MB memory pool

static uint8_t memory_pool[MEMORY_POOL_SIZE];
static uint8_t *memory_pointer = memory_pool;

void *kmalloc(size_t size) {
    if (memory_pointer + size > memory_pool + MEMORY_POOL_SIZE) {
        return NULL;  // Not enough memory
    }
    void *ptr = memory_pointer;
    memory_pointer += size;
    return ptr;
}

void kfree(void *ptr) {
    // In a simple memory management system, we do not actually free memory.
    // This is a placeholder for future implementation.
}

void memory_init() {
    memory_pointer = memory_pool;  // Reset memory pointer
}